<%@LANGUAGE="VBSCRIPT"%>

<% Server.ScriptTimeout = 800 'spr_dzienne = "dzienne=1 and " spr_dzienne = "" sumuj_wpisy = true id=request.QueryString("id") typ=request.QueryString("t") set objs=server.CreateObject("adodb.recordset") objs.open "select * from t_stat_typy where id_typu="&typ,conn,1,3 if objs.eof then response.Write("błąd") else sql_tab_zlacz = objs("tabela_zlacz") sql_tab_nazwa = objs("tab_nazwa") sql_tab_id = objs("tab_id") typ_tytul = objs("tytul") typ_tytul_kolumna = objs("tytul_kolumna") tab_sql_obiekt = objs("tab_sql_obiekt") end if objs.close %> Statystyki <% 'response.end %> <% ilewmies=Array(31,28,31,30,31,30,31,31,30,31,30,31) miesiace=Array("Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień") dim iloscdz(32) aktrok=year(now) poprok=aktrok aktmies=month(now) aktmies_nazwa = miesiace(aktmies-1) popmies=aktmies-1 if popmies=0 then popmies=12 poprok=poprok-1 end if popmies_nazwa = miesiace(popmies-1) aktilewmies=ilewmies(aktmies-1) max=0 objs.open "SELECT *, day(data) as dzien FROM t_stats_daily WHERE id="&id&" and typ="&typ&" and month(data)="&aktmies&" and year(data)="&aktrok,conn,1,3 'Response.Write(objs.Source) ileaktmies=0 while not objs.eof ileaktmies=ileaktmies+objs("ilosc") if sumuj_wpisy=true then iloscdz(objs("dzien"))=iloscdz(objs("dzien"))+objs("ilosc") else iloscdz(objs("dzien"))=objs("ilosc") end if if iloscdz(objs("dzien"))>max then max=iloscdz(objs("dzien")) end if objs.movenext wend objs.close %> <% razem=0 aktmies=month(now)-1 aktrok=year(now) if aktmies=0 then aktmies=12 aktrok=aktrok-1 end if aktilewmies=ilewmies(aktmies-1) for i=1 to aktilewmies iloscdz(i)=0 next max=0 objs.open "SELECT *, day(data) as dzien FROM t_stats_daily WHERE id="&id&" and typ="&typ&" and month(data)="&aktmies&" and year(data)="&aktrok,conn,1,3 ilepopmies=0 while not objs.eof ilepopmies=ilepopmies+objs("ilosc") if sumuj_wpisy=true then iloscdz(objs("dzien"))=iloscdz(objs("dzien"))+objs("ilosc") else iloscdz(objs("dzien"))=objs("ilosc") end if if iloscdz(objs("dzien"))>max then max=iloscdz(objs("dzien")) end if objs.movenext wend objs.close %> <% dim iloscmie(13) aktilewmies=ilewmies(aktmies-1) aktrok=year(now) objs.open "SELECT convert(int,right(data,2)) as miesiac, sum(ilosc) as ilosc FROM t_stats_monthly WHERE id="&id&" and typ="&typ&" and convert(int,left(data,4))="&aktrok&" group by convert(int,right(data,2))",conn,1,3 if aktmies=12 then iloscmie(1)=ileaktmies if iloscmie(1)>max then max=iloscmie(1) end if else iloscmie(aktmies+1)=ileaktmies if iloscmie(aktmies+1)>max then max=iloscmie(aktmies+1) end if end if if aktmies<12 then iloscmie(aktmies)=ilepopmies end if if iloscmie(aktmies)>max then max=iloscmie(aktmies) end if while not objs.eof if sumuj_wpisy=true then iloscmie(objs("miesiac"))=iloscmie(objs("miesiac"))+objs("ilosc") else iloscmie(objs("miesiac"))=objs("ilosc") end if if iloscmie(objs("miesiac"))>max then max=iloscmie(objs("miesiac")) end if objs.movenext wend objs.close dim zlicz(12) dim zlicz_zakres(12) for j=1 to 12 zlicz(j)=0 next ostrok = year(now) ostmies = month(now) ilezlicz = 0 while ostrok = year(now) for j=1 to 12 if ilezlicz < j then zlicz(j)=zlicz(j)+iloscmie(ostmies) zlicz_zakres(j) = miesiace(ostmies-1)&" "&aktrok end if next ilezlicz = ilezlicz + 1 ostmies=ostmies-1 if ostmies < 1 then ostmies = 12 ostrok = ostrok - 1 end if wend %>
<% if not isnull(tab_sql_obiekt) then tab_sql_obiekt=replace(tab_sql_obiekt, "$id", id) nazwa_obiektu=conn.execute(tab_sql_obiekt)(0) response.write ""&nazwa_obiektu&"" end if %>
<% for i=1 to aktilewmies %> <% next %> <% for i=1 to aktilewmies %><% next %> <% for i=1 to aktilewmies %><% next %>
Bieżący miesiąc - <%=aktmies_nazwa%> <%=aktrok%>
" width="6">
<%=iloscdz(i)%>
<%=i%>
<% for i=1 to aktilewmies %> <% next %> <% for i=1 to aktilewmies %><% next %> <% for i=1 to aktilewmies %><% next %>
Poprzedni miesiąc - <%=popmies_nazwa%> <%=poprok%>
<%=iloscdz(i)%>
<%=i%><%razem=razem+iloscdz(i)%>
<% for i=1 to 12 %> <% next %> <% for i=1 to 12 %><% next %> <% for i=1 to 12 %><% next %>
Bieżący rok - <%=aktrok%>
<%=iloscmie(i)%>
<%=miesiace(i-1)%>
<% for i=1 to 12 iloscmie(i)=0 next aktilewmies=ilewmies(aktmies-1) aktrok=year(now)-1 if aktmies=12 then iloscmie(aktmies)=ilepopmies end if objs.open "SELECT convert(int,right(data,2)) as miesiac, sum(ilosc) as ilosc FROM t_stats_monthly WHERE id="&id&" and typ="&typ&" and convert(int,left(data,4))="&aktrok&" group by convert(int,right(data,2))",conn,1,3 response.write "" while not objs.eof if sumuj_wpisy=true then iloscmie(objs("miesiac"))=iloscmie(objs("miesiac"))+objs("ilosc") else iloscmie(objs("miesiac"))=objs("ilosc") end if if iloscmie(objs("miesiac"))>max then max=iloscmie(objs("miesiac")) end if objs.movenext wend objs.close %> <% while ilezlicz<12 for j=1 to 12 if ilezlicz < j then zlicz(j)=zlicz(j)+iloscmie(ostmies) zlicz_zakres(j) = miesiace(ostmies-1)&" "&aktrok end if next ilezlicz = ilezlicz + 1 ostmies=ostmies-1 if ostmies < 1 then ostmies = 12 ostrok = ostrok - 1 end if wend %> <% for j=1 to 12 zlicz_zakres(j)=zlicz_zakres(j)&" - "&miesiace(month(now)-1)&" "&year(now) next %> <% for i=1 to 12 %> <% next %> <% for i=1 to 12 %><% next %> <% for i=1 to 12 %><% next %>
Poprzedni rok - <%=aktrok%>
<%=iloscmie(i)%>
<%=miesiace(i-1)%>
Ostatnie 12 miesięcy <%=zlicz_zakres(12)%>: <%=zlicz(12)%>
Ostatnie 9 miesięcy <%=zlicz_zakres(9)%>: <%=zlicz(9)%>
Ostatnie 6 miesięcy <%=zlicz_zakres(6)%>: <%=zlicz(6)%>
Ostatnie 3 miesięcy <%=zlicz_zakres(3)%>: <%=zlicz(3)%>
<% if false then %> <% objs.open "SELECT top 100 * from t_stat_info1 where id_choroby="&idch&" order by data desc",conn,1,3 %>
<% while not objs.eof %> <% objs.movenext wend objs.close %>
kiedy kto skąd
<%=objs("data")%> <%=objs("remote_addr")%> <%=objs("http_referer")%>
<% end if %>